<?php

namespace app\index\controller;

use app\index\model\Type as TypeModel;
use app\index\model\Casus as CasusModel;
use think\Controller;
use think\Request;

class Casus extends BaseController
{
    /**
     * 案例类目
     */
    public function type()
    {
        $type = TypeModel::getByType(1);
        $this->successes(compact('type'));
    }

    /**
     * 案例列表
     */
    public function lists()
    {
        $size = $this->request->get('size');
        $typeId = $this->request->get('type_id');
        $casus = CasusModel::getCasus($typeId, $size);
        $this->successes([
            'casus' => $casus->items(),
            'total' => $casus->total()
        ]);
    }
}
